<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const name = "user" + "name";
      const person = {
        firstName: "li",
        lastName: "jack",
        get fullName() {
          return `${this.lastName} ${this.firstName}`;
        },
        set fullName(value) {
          [this.lastName, this.firstName] = value.split(" ");
        },
      };

      const admin = {
        __proto__: person,
      };

      /*
      1. 方法或函数中的this指向调用他的对象 admin.fullName() =>  return `${admin.lastName} ${admin.firstName}`; 
      2. admin.lastName 读取任何属性都会触发原型链查找
      3. admin.fullName = "lili zhang"; ① 设置对象中不存在的属性属性，相当于新增属性。② 基于原型触发了Perons.setfullName(例外)
      4.  set fullName(value) [admin.lastName, admin.firstName] = value.split(" ");
      */
      console.log(admin.fullName);
      admin.fullName = "lili zhang"; // admin.fullName('lili zhang')

      console.log(person);
      console.log(admin);

      // console.log(admin.fullName); // admin.fullName()
    </script>
  </body>
</html>
